package com.cy.pj.common.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

/**
 * @Author YuBaoFu
 * @create 2025/06/09
 * @description
 */
@Aspect
@Component
@Slf4j
public class SysExceptionAspect {

    @AfterThrowing(pointcut = "bean(*ServiceImpl)",throwing = "e")
    public void getException(JoinPoint joinPoint,Exception e){
        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
        log.error("Exception => " + signature.getName()+e.getMessage());
    }

}
